﻿Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Data
Imports System.Data.OleDb
Imports System.Windows.Forms
Imports System.Collections
Imports _1065081_1065104.KHDTO
Imports _1065081_1065104.KHDAO
Imports _1065081_1065104.Global_Class
Imports System.Data.SqlClient


Namespace KHBUS
    Public Class Cbusikhachhang
        Private _cusData As New CkhachhangDAO
        Public Sub Insert(ByVal _nhanvien As Cinforkhachhang)
            Dim bState As Boolean = _cusData.AddNewnhanvien(_nhanvien)
            If bState = True Then
                MessageBox.Show("Đã thêm mới nhan vien mã số " & _nhanvien.nhanvienid, "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Else
                MessageBox.Show("Không thể thêm mới khách hàng mã số " & _nhanvien.nhanvienid, "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Information)
            End If
        End Sub
        Public Sub Delete(ByVal _cusID As String)
            Dim bState As Boolean = _cusData.Deletenhanvien(_cusID.Trim())
            If bState = True Then
                MessageBox.Show("Đã xóa khách hàng mã số " & _cusID, "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Else
                MessageBox.Show("Không thể xóa khách hàng mã số " & _cusID, "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Information)
            End If
        End Sub
        Public Sub Update(ByVal _nhanvien As Cinforkhachhang)
            Dim bState As Boolean = _cusData.Updatenhanvien(_nhanvien)
            If bState = True Then
                MessageBox.Show("Đã cập nhật khách hàng mã số " & _nhanvien.nhanvienid, "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Else
                MessageBox.Show("Không thể cập nhật khách hàng mã số " & _nhanvien.nhanvienid, "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Information)
            End If
        End Sub
        Public Function Search(ByVal _idCode As String, ByVal _cusName As String, ByVal _cusIdentity As String, ByVal _cusTel As String) As DataTable
            Return _cusData.Searchnhanvien(_idCode, _cusName, _cusIdentity, _cusTel)
        End Function
        Public Function GetnhanvienID(ByVal strID As String, ByVal field As String, ByVal table As String, ByVal length As Integer) As String
            Return _cusData.GetnhanvienID(strID, field, table, length)
        End Function
    End Class
End Namespace


